import Router from "koa-router";
import { getControlles,regControlers } from "../utils/tools.js";
import bodyParser from "koa-bodyparser";
import cors from'@koa/cors'

let router = new Router();

export const useControllers = function(app){
    app.use(bodyParser())
    app.use(cors())

    let controllersFiles = getControlles();
    regControlers (router,controllersFiles) 

    app.use(router.routes())
}